package bitetorrentserver;

import java.io.Serializable;

/**
 *
 * @author user
 */
public class File implements Serializable, Comparable<File> {

    // File Name
    public String filename;
    // Owner (IP address)
    public String address;

    /**
     * Constructor
     * @param filename
     * @param address
     */
    public File(String filename, String address) {
        this.filename = filename;
        this.address = address;
    }

    @Override
    public String toString() {
        return "Filename : " + filename + "\n" + "address : " + address;
    }

    public int compareTo(File o) {
        if (filename != null && filename.equals(o.filename) && address != null && address.equals(o.address)) {
            // Equal
            return 0;
        }

        // Not equal
        return -1;
    }
}
